package com.wengluobiancheng.demo04;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.DatagramSocket;
import java.net.Socket;

public class ClientDemo01 {
    public static void main(String[] args) throws IOException {
        Socket sk = new Socket("192.168.29.222", 10086);
        OutputStream os = sk.getOutputStream();
        os.write("Hello".getBytes());
        sk.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(sk.getInputStream()));
        String ling;
        while ((ling = br.readLine()) != null) {
            System.out.println(ling);

        }
        sk.close();
        os.close();
        br.close();
    }
}
